package com.fighting.acti.listener;

import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;

public class CommonProcSetCandidateListener implements TaskListener {
    @Override
    public void notify(DelegateTask delegateTask) {
        String taskKey = delegateTask.getTaskDefinitionKey();
        if("apply".equals(taskKey)){
            delegateTask.setAssignee("u1");
        }else if("check".equals(taskKey)){
            delegateTask.setAssignee("u2");
        }else if("approve1".equals(taskKey)){
//            delegateTask.setAssignee("u3");
            // 当分配CandidateUser时必须将assignee设为null
            delegateTask.addCandidateUser("u33");
        }
    }
}
